<template>
  <div id="app">
    <van-cell
      is-link
      @click="showPopup"
    >
    </van-cell>

    <van-popup
      v-model="show"
      position="left"
      :style="{ width: '80%', height: '100%' }"
    />
    <van-nav-bar
      left-text="返回"
      right-text="按钮"
      @click-left="onClickLeft"
      @click-right="onClickRight"
      fixed
    >
      <template #left>
        <van-cell
          is-link
          @click="showPopup"
        >
        </van-cell>

        <van-popup
          v-model="show"
          position="left"
          :style="{ width: '80%', height: '100%' }"
        />
        <van-icon
          size="18"
          class="iconfont icon-daohang"
        />
      </template>
      <template #title>
        <div ref="mytitle">{{title}}</div>
      </template>
      <template #right>
        <!-- <van-icon
          class="iconfont icon-huatong"
          size="18"
        /> -->
        <div ref="myright">{{right}}</div>
      </template>
    </van-nav-bar>
    <router-link to=""></router-link>
    <van-tabbar
      v-model="active"
      id="nav"
      fixed
    >
      <van-tabbar-item
        icon="fire-o"
        to="/"
      >发现</van-tabbar-item>
      <van-tabbar-item
        icon="gift-o"
        to="/boke"
      >播客</van-tabbar-item>
      <van-tabbar-item
        icon="user-o"
        to="/mine"
      >我的</van-tabbar-item>
      <van-tabbar-item
        icon="bullhorn-o"
        to="k_ge"
      >K歌</van-tabbar-item>
      <van-tabbar-item
        icon="friends-o"
        to="/cloudCountry"
      >云村</van-tabbar-item>
    </van-tabbar>
    <router-view />
  </div>
</template>
<script>
import { Toast } from 'vant';
export default {
  data() {
    return {
      active: 0,
      show: false,
      title: '',
      right: ''
    }
  },
  methods: {
    onClickLeft() { },
    onClickRight() {
      Toast('按钮');
    },
    showPopup() {
      this.show = true;
    }
  },
  watch: {
    '$route.meta'(meta) {
      this.$refs.mytitle.innerHTML = meta.title;
      this.$refs.myright.innerHTML = meta.right;
    }
  },
  updated() {
    console.log(this.$refs.mytitle);
  }
};
</script>
<style lang="scss">
@import "assets/icon/iconfont.css";
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  .van-nav-bar {
    .van-icon {
      color: #333;
    }
  }
  #nav {
    padding: 0px;
    a {
      font-weight: bold;
      color: #2c3e50;
    }
    a.router-link-exact-active {
      color: #42b983;
    }
  }
  .van-cell::after {
    display: none;
  }
  .van-cell {
    padding: 0px;
    .van-icon-arrow::before {
      display: none;
    }
  }
}
</style>
